<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-3.1.1.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>住院处方</title>
<style type="text/css">
.cc_item {
	padding: 10px;
}
</style>
</head>
<body>
	<script type="text/javascript">
var editIndex = undefined;
//结束正在编辑的行
function endEditing(){
	if (editIndex == undefined){return true}
	if ($('#cc_prescribe_dg').datagrid('validateRow', editIndex)){
			var pharStockMed = $("#cc_prescribe_dg").datagrid('getEditor', {
		 		index: editIndex,
		 		field: 'mai_Money'
		 	});
			
			var epAmount = $("#cc_prescribe_dg").datagrid('getEditor', {
		 		index: editIndex,
		 		field: 'list.epAmount'
		 	});
			var edmenoy = $("#cc_prescribe_dg").datagrid('getEditor', {
		 		index: editIndex,
		 		field: 'list.edmenoy'
		 	});
			var cc_shul=$(epAmount.target).numberbox("getValue");
			var cc_danjia=$(pharStockMed.target).textbox("getValue");
			if(cc_shul<=0){
				cc_shul=1;
				$(epAmount.target).numberbox("setValue",cc_shul);
			}
			$(edmenoy.target).textbox("setValue",cc_shul*cc_danjia);
			$('#cc_prescribe_dg').datagrid('endEdit', editIndex);
		
		editIndex = undefined;
		return true;
	} else {
		return false;
	}
}
//事件：单击单元格的事件
function onClickCell(index, field){
	if (editIndex != index){
		if (endEditing()){
			$('#cc_prescribe_dg').datagrid('selectRow', index)
					.datagrid('beginEdit', index);
			var ed = $('#cc_prescribe_dg').datagrid('getEditor', {index:index,field:field});
			if (ed){
				($(ed.target).data('textbox') ? $(ed.target).textbox('textbox') : $(ed.target)).focus();
			}
			onAddshuj(index);
			editIndex = index;
		} else {
			setTimeout(function(){
				$('#cc_prescribe_dg').datagrid('selectRow', editIndex);
			},0);
		}
		
	}
	
}
//onClickRow
function seachPharStock(pharStock){
	//条件搜索
	//cc_pharStock_search
	$('#cc_pharStock_search').searchbox({
		searcher:function(value,name){
		  $(pharStock.target).combogrid({
	    		url: 'tocc_queryAllLikeYp', 
	    		method: 'post', 
	    		queryParams: {
	    			pharStockMedName:value,
	    		}});
		}});
}
//监听datagrid的点击事件
function onAddshuj(index) {
	
	var cc_prescribeName =$("#cc_prescribe_dg").datagrid('getEditor', {
 		index: index,
 		field: 'list.prescribeName'
 	});
	seachPharStock(cc_prescribeName);
	$(cc_prescribeName.target).combogrid({
 		onChange:function(){
 			var pharStockMedId=$(this).combogrid('getValue');
 			var pharStockMed = $("#cc_prescribe_dg").datagrid('getEditor', {
		 		index: index,
		 		field: 'mai_Money'
		 	});
 			var cc_list_drugId = $("#cc_prescribe_dg").datagrid('getEditor', {
		 		index: index,
		 		field: 'list.drugId'
		 	});
 			$(cc_list_drugId.target).textbox("setValue",pharStockMedId);
 			$.getJSON("tocc_queryBymaiMoney", {"pharStockMedId": pharStockMedId}, function(data){
				$("<form id='cc_dddff' type='hidden'>").appendTo($("body"));
				$("<input id='cc_mai' name='maiMoney'>").appendTo($("#cc_dddff"));
				//$(pharStockMed.target).text("setValue",date);
				$("#cc_dddff").form("load",data);
				$(pharStockMed.target).textbox("setValue",$("#cc_mai").val());
				var cc_phar= $(pharStockMed.target).textbox("getValue");
				$(pharStockMed.target).textbox("setText",cc_phar);
				$("#cc_mai").remove();
				$("#cc_dddff").remove();
			}); 
 		}
 		});
      }
//onAfterEdit 当用户完成编辑一行时触发
//结束编辑，同步数据
function onEndEdit(index, row){
	var ed = $(this).datagrid('getEditor', {
		index: index,
		field: 'list.prescribeName'
	});
	row['list.drugId'] = $(ed.target).combobox('getValue');
	row['list.prescribeName'] = $(ed.target).combobox('getText');
	onAddshuj(index);
	
}

//添加行
function append(){
	if (endEditing()){
		$('#cc_prescribe_dg').datagrid('appendRow',{'list.drugId': [],'list.prescribeName': [], 'list.epAmount': [],'mai_Money': [],'list.edmenoy': []});
		editIndex = $('#cc_prescribe_dg').datagrid('getRows').length-1;
		$('#cc_prescribe_dg').datagrid('selectRow', editIndex)
				.datagrid('beginEdit', editIndex);
		onAddshuj(editIndex);
	}
}

//删除行
function removeit(){
	if (editIndex == undefined){return}
	$('#cc_prescribe_dg').datagrid('cancelEdit', editIndex)
			.datagrid('deleteRow', editIndex);
	editIndex = undefined;
}

//应用
function accept(){
	if (endEditing()){
		//$('#cc_prescribe_dg').datagrid('acceptChanges');
		endEditing();
	}
}

//撤消
function reject(){
	$('#cc_prescribe_dg').datagrid('rejectChanges');
	editIndex = undefined;
}

//获取数据
function getChanges(){
	var rows = $('#cc_prescribe_dg').datagrid('getChanges');
	alert(rows.length+' rows are changed!');
}

//提交处方

function saveHospele(){
	//将datagrid中的数据行保存到隐式表单域中
	var  shenpi_staffId = $("#tontyiStaffId").html();
		
	$("#pdoctoerid").val(shenpi_staffId);
	//1、获取新增的数据行
	var rows = $('#cc_prescribe_dg').datagrid('getChanges');
	console.log(JSON.stringify(rows));
	
	//为每一行生成对应的隐藏表单域
	//list.prescribeName
	for(var i = 0; i < rows.length; i ++){
		generateHidden(rows[i], "drugId", i);
		generateHidden(rows[i], "prescribeName", i);
		generateHidden(rows[i], "epAmount", i);
		generateHidden(rows[i], "edmenoy", i);
	}
	
	var ff_plan = $("#cc_eait_hospele_prescribe_form");
	//提交表单
	ff_plan.form("submit", {
		success: function(data){
			var json = eval("(" + data + ")");
			$.messager.alert("提示", json.reason);
			$("#cc_eait_hospele_prescribe_win").window('close');
			$(":hidden[x='y']").remove();
			reject();
			$("#show_query_hospele_tab").datagrid("reload");
		}
	});
}
//修改处方

function updateHospele(rows,cc_upele_id,cc_hosppritineid){
	//将datagrid中的数据行保存到隐式表单域中
	var  shenpi_staffId = $("#tontyiStaffId").html();
	$("#pdoctoerid").val(shenpi_staffId);
	console.log(JSON.stringify(rows));
	var ff_plan = $("#cc_update_hospele_heSickid_form");
	//为每一行生成对应的隐藏表单域
	//list.prescribeName
	for(var i = 0; i < rows.length; i ++){
		updategenerateHidden(rows[i], "drugId", i,ff_plan);
		updategenerateHidden(rows[i], "prescribeName", i,ff_plan);
		updategenerateHidden(rows[i], "epAmount", i,ff_plan);
		updategenerateHidden(rows[i], "edmenoy", i,ff_plan);
	}
	
	
	//提交表单
	//tocc_updatehospEle
	ff_plan.form("submit", {
		url:'tocc_updatehospEle',
		onSubmit: function(param){    
	        param.upele_id = cc_upele_id;
	        param.pritineid =  cc_hosppritineid;
	    },
		success: function(data){
			var json = eval("(" + data + ")");
			$.messager.alert("提示", json.reason);
			$("#cc_update_hospele_prescribe_win").window('close');
			$(":hidden[x='y']").remove();
			reject();
			$("#show_query_hospele_tab").datagrid("reload");
		}
	});
}
function updateHospelecheck(rows,cc_upele_id,cc_hosppritineid){
	//将datagrid中的数据行保存到隐式表单域中
	var  shenpi_staffId = $("#tontyiStaffId").html();
	$("#pdoctoerid").val(shenpi_staffId);
	console.log(JSON.stringify(rows));
	var ff_plan = $("#cc_update_hospele_check_heSickid_form");
	//为每一行生成对应的隐藏表单域
	//list.prescribeName
	//elecname eleCheckName etmenoy
	for(var i = 0; i < rows.length; i ++){
		updategenerateHiddencheck(rows[i], "elecname", i,ff_plan);
		updategenerateHiddencheck(rows[i], "eleCheckName", i,ff_plan);
		updategenerateHiddencheck(rows[i], "etmenoy", i,ff_plan);
	}
	
	
	//提交表单
	//tocc_updatehospEle
	ff_plan.form("submit", {
		url:'tocc_updatehospElecheck',
		onSubmit: function(param){    
	        param.upele_id = cc_upele_id;
	        param.pritineid =  cc_hosppritineid;
	    },
		success: function(data){
			var json = eval("(" + data + ")");
			$.messager.alert("提示", json.reason);
			$("#cc_update_hospele_check_win").window('close');
			$(":hidden[x='y']").remove();
			reject();
			$("#show_query_hospele_tab").datagrid("reload");
		}
	});
}
function generateHidden(row, name, i){
	//details.planDetail
	var ff_plan = $("#cc_eait_hospele_prescribe_form");
	$("<input type='hidden' x='y'>")
		.attr("name", "list["+i+'].'+name)
		.val(row['list.' + name])
		.appendTo(ff_plan);
}
function updategenerateHidden(row, name, i,ff_plan){
	//details.planDetail
	$("<input type='hidden' x='y'>")
		.attr("name", "list["+i+'].'+name)
		.val(row[name])
		.appendTo(ff_plan);
}
//updategenerateHiddencheck
function updategenerateHiddencheck(row, name, i,ff_plan){
	//details.planDetail
	$("<input type='hidden' x='y'>")
		.attr("name", "list["+i+'].'+name)
		.val(row[name])
		.appendTo(ff_plan);
}
</script>
	<script type="text/javascript">
		var cc_editIndex = undefined;
		//结束正在编辑的行
		function cc_endEditing() {
			if (cc_editIndex == undefined) {
				return true
			}
			if ($('#cc_prescribe_check_dg').datagrid('validateRow',
					cc_editIndex)) {
				var pharcprNum = $("#cc_prescribe_check_dg").datagrid(
						'getEditor', {
							index : cc_editIndex,
							field : 'cprNum'
						});

				var etAmount = $("#cc_prescribe_check_dg").datagrid(
						'getEditor', {
							index : cc_editIndex,
							field : 'check_etAmount'
						});
				var etmenoy = $("#cc_prescribe_check_dg").datagrid('getEditor',
						{
							index : cc_editIndex,
							field : 'list.etmenoy'
						});
				var cc_danjia = $(pharcprNum.target).textbox("getValue");
				$(etAmount.target).numberbox("setValue", 1);
				var cc_shul = $(etAmount.target).numberbox("getValue");
				$(etmenoy.target).textbox("setValue", cc_shul * cc_danjia);
				$('#cc_prescribe_check_dg').datagrid('endEdit', cc_editIndex);

				cc_editIndex = undefined;
				return true;
			} else {
				return false;
			}
		}
		//事件：单击单元格的事件
		function cc_onClickCell(index, field) {
			if (cc_editIndex != index) {
				if (cc_endEditing()) {
					$('#cc_prescribe_check_dg').datagrid('selectRow', index)
							.datagrid('beginEdit', index);
					var ed = $('#cc_prescribe_check_dg').datagrid('getEditor',
							{
								index : index,
								field : field
							});
					if (ed) {
						($(ed.target).data('textbox') ? $(ed.target).textbox(
								'textbox') : $(ed.target)).focus();
					}
					cc_onAddshuj(index);
					cc_editIndex = index;
				} else {
					setTimeout(function() {
						$('#cc_prescribe_check_dg').datagrid('selectRow',
								cc_editIndex);
					}, 0);
				}

			}

		}
		//onClickRow
		//监听datagrid的点击事件
		function cc_onAddshuj(index) {
			$($("#cc_prescribe_check_dg").datagrid('getEditor', {
				index : index,
				field : 'list.eleCheckName'
			}).target).combogrid(
					{
						onChange : function() {
							var prcheckid = $(this).combogrid('getValue');
							var prcheckNum = $("#cc_prescribe_check_dg")
									.datagrid('getEditor', {
										index : index,
										field : 'cprNum'
									});
							var cc_prcheckId = $("#cc_prescribe_check_dg")
									.datagrid('getEditor', {
										index : index,
										field : 'list.elecname'
									});

							$(cc_prcheckId.target).textbox("setValue",
									prcheckid);
							$.getJSON("tocc_queryOneCheck", {
								"cprId" : prcheckid
							}, function(data) {
								$("<form id='cc_dddfff' type='hidden'>")
										.appendTo($("body"));
								$("<input id='cc_check' name='cprNum'>")
										.appendTo($("#cc_dddfff"));
								//$(pharStockMed.target).text("setValue",date);
								$("#cc_dddfff").form("load", data);
								$(prcheckNum.target).textbox("setValue",
										$("#cc_check").val());

								var cc_phar = $(prcheckNum.target).textbox(
										"getValue");
								$(prcheckNum.target)
										.textbox("setText", cc_phar);
								$("#cc_check").remove();
								$("#cc_dddfff").remove();
							});
						}
					});
		}
		//结束编辑，同步数据
		function cc_onEndEdit(index, row) {
			var ed = $(this).datagrid('getEditor', {
				index : index,
				field : 'list.eleCheckName'
			});
			row['list.elecname'] = $(ed.target).combobox('getValue');
			row['list.eleCheckName'] = $(ed.target).combobox('getText');
			cc_onAddshuj(index);

		}

		//添加行
		function cc_append() {
			if (cc_endEditing()) {
				$('#cc_prescribe_check_dg').datagrid('appendRow', {
					'list.elecname' : [],
					'list.eleCheckName' : [],
					'check_etAmount' : [],
					'cprNum' : [],
					'list.etmenoy' : []
				});
				cc_editIndex = $('#cc_prescribe_check_dg').datagrid('getRows').length - 1;
				$('#cc_prescribe_check_dg').datagrid('selectRow', cc_editIndex)
						.datagrid('beginEdit', cc_editIndex);
				cc_onAddshuj(cc_editIndex);
			}
		}

		//删除行
		function cc_removeit() {
			if (cc_editIndex == undefined) {
				return
			}
			$('#cc_prescribe_check_dg').datagrid('cancelEdit', cc_editIndex)
					.datagrid('deleteRow', cc_editIndex);
			cc_editIndex = undefined;
		}

		//应用
		function cc_accept() {
			if (cc_endEditing()) {
				//$('#cc_prescribe_check_dg').datagrid('acceptChanges');
				cc_endEditing();
			}
		}

		//撤消
		function cc_reject() {
			$('#cc_prescribe_check_dg').datagrid('rejectChanges');
			cc_editIndex = undefined;
		}

		//获取数据
		function cc_getChanges() {
			var rows = $('#cc_prescribe_check_dg').datagrid('getChanges');
			alert(rows.length + ' rows are changed!');
		}

		//提交处方

		function cc_saveHospele() {
			//将datagrid中的数据行保存到隐式表单域中
			var  shenpi_staffId = $("#tontyiStaffId").html();
			$("#cc_hospele_check_heDoctorid").val(shenpi_staffId);
			$("#pdoctoerid").val(shenpi_staffId);
			//1、获取新增的数据行
			var rows = $('#cc_prescribe_check_dg').datagrid('getChanges');
			console.log(JSON.stringify(rows));

			//为每一行生成对应的隐藏表单域
			//list.eleCheckName
			for (var i = 0; i < rows.length; i++) {
				cc_generateHidden(rows[i], "elecname", i);
				cc_generateHidden(rows[i], "eleCheckName", i);
				cc_generateHidden(rows[i], "etmenoy", i);
			}

			var ff_plan = $("#cc_eait_hospele_check_form");
			//提交表单
			ff_plan.form("submit", {
				success : function(data) {
					var json = eval("(" + data + ")");
					$.messager.alert("提示", json.reason);
					$("#cc_eait_hospele_check_win").window('close');
					$(":hidden[x='y']").remove();
					cc_reject();
					$(this).form("clear");
					$("#show_query_hospele_tab").datagrid("reload");
				}
			});
		}

		function cc_generateHidden(row, name, i) {
			//details.planDetail
			var ff_plan = $("#cc_eait_hospele_check_form");
			$("<input type='hidden' x='y'>").attr("name",
					"list[" + i + '].' + name).val(row['list.' + name])
					.appendTo(ff_plan);
		}
		function  cc_hosp_rowStlye(index,row){
			//alert(new Date());
			var date = new Date();
		    var seperator1 = "/";
		    var month = date.getMonth() + 1;
		    var strDate = date.getDate();
		    if (month >= 1 && month <= 9) {
		        month = "0" + month;
		    }
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		    }
		    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
		    if (row.heDate==currentdate){
				return 'background-color:#CCFF99;color:red;';
			}
			
		}
	</script>
	<script type="text/javascript">
		$(function() {
			var  shenpi_staffId = $("#tontyiStaffId").html();
			$("#pdoctoerid").val(shenpi_staffId);
			$("#cc_hospele_heDoctorid").val(shenpi_staffId);
			var val = shenpi_staffId;
			$("#show_query_hospele_tab").datagrid({
				url : 'tocc_queryAllhospEle',
				queryParams : {
					docterid : val
				}
			});
			//cc_electronicsearch
			//docterid,String pname
			$('#cc_electronicsearch').searchbox({
		    searcher:function(value,name){
		    	if(name=="病人姓名"){
		    		$("#show_query_hospele_tab").datagrid({
			    		url:'tocc_queryByhospelepname',
			    		queryParams: {
			    			pname: value,
			    		}
			    	});
		    	}else{
		    		$("#show_query_hospele_tab").datagrid({
			    		url:'tocc_queryByhospelepicid',
			    		queryParams: {
			    			icid: value
			    		}
			    	});
		    	}
		    	
		    }
		});
			
			$("#add_electronic_prescribe_btn").linkbutton({
				onClick : function() {
					$("#cc_eait_hospele_prescribe_win").window({
						title : "添加药品处方"
					});
					$("#cc_eait_hospele_prescribe_win").window("open");
				}
			});
			$("#add_electronic_check_btn").linkbutton({
				onClick : function() {
					$("#cc_eait_hospele_check_win").window({
						title : "添加检查处方"
					});
					$("#cc_eait_hospele_check_win").window("open");
				}
			});
			//查询病人
			$("#cc_hospele_heSickid").combogrid({
				url : 'tocc_queryBypadoctorid',
				queryParams : {
					padoctorid : val
				}
			});
			//cc_update_hospele_heSickid
			$("#cc_hospele_check_heSickid").combogrid({
				url : 'tocc_queryBypadoctorid',
				queryParams : {
					padoctorid : val
				}
			});//cc_hospele_check_heSickid
			//刷新
			$("#cc_hospelectronic_ref").linkbutton({
				onClick : function() {
					$("#show_query_hospele_tab").datagrid({
						url : 'tocc_queryAllhospEle',
						queryParams : {
							docterid : val
						}
					});
				}
			});
			var ele_id;
			//修改up_electronic_btn
			$("#up_electronic_btn").linkbutton(
					{
						onClick : function() {
							var rows = $("#show_query_hospele_tab").datagrid(
									"getSelections");
							if (rows.length == 1) {
								if(rows[0].hospeleRemarks=='未完成'){
									ele_id = rows[0].heId;
									if (rows[0].heType == '检查') {
										$("#cc_update_hospele_check_win").window({
											title : "修改检查处方"
										});
										$.getJSON("tocc_queryByOneElehosp", {
											"eleId" : ele_id
										}, function(data) {
											//$(pharStockMed.target).text("setValue",date);
											$("#cc_update_hospele_check_heSickid_form")
													.form("load", data);
										});
										$("#cc_update_preCheck_dg").datagrid({
											url : 'tocc_queryByElepreCheck',
											queryParams : {
												eleId : ele_id
											}
										});
										$("#cc_update_hospele_check_heSickid").combogrid({
											url : 'tocc_queryBypadoctorid',
											queryParams : {
												padoctorid : val
											}
										});
										$("#cc_update_hospele_check_win").window(
												"open");

									} else {

										$.getJSON("tocc_queryByOneElehosp", {
											"eleId" : ele_id
										}, function(data) {
											//$(pharStockMed.target).text("setValue",date);
											$("#cc_update_hospele_heSickid_form")
													.form("load", data);
										});
										$("#cc_update_prescribe_dg").datagrid({
											url : 'tocc_queryByElepre',
											queryParams : {
												eleId : ele_id
											}
										});
										//cc_update_hospele_heSickid
										$("#cc_update_hospele_heSickid").combogrid({
											url : 'tocc_queryBypadoctorid',
											queryParams : {
												padoctorid : val
											}
										});
										$("#cc_update_hospele_prescribe_win")
												.window({
													title : "修改药品处方"
												});
										$("#cc_update_hospele_prescribe_win")
												.window("open");
									}
								}else {
									//tocc_queryByElepreCheck
									if(rows[0].heType == '检查'){
										var cc_ele_id = rows[0].heId;
										ele_id=rows[0].heId;
										var cc_ele_pname = rows[0].pname;
										$.getJSON("tocc_queryByOneElehosp", {
											"eleId" : cc_ele_id
										}, function(data) {
											//$(pharStockMed.target).text("setValue",date);
											$("#cc_show_hospele_check_heSickid_form")
													.form("load", data);
										});
										$("#cc_show_hospeletronic_check_dg").datagrid({
											url : 'tocc_queryByElepreCheck',
											queryParams : {
												eleId : cc_ele_id
											}
										});
										$("#cc_show_check_heSickid").textbox("setText",cc_ele_pname);
										$("#cc_show_hospele_check_win").window("open");
									}else{
										var cc_ele_id = rows[0].heId;
										ele_id=rows[0].heId;
										var cc_ele_pname = rows[0].pname;
										$.getJSON("tocc_queryByOneElehosp", {
											"eleId" : cc_ele_id
										}, function(data) {
											//$(pharStockMed.target).text("setValue",date);
											$("#cc_show_hospele_heSickid_form")
													.form("load", data);
										});
										$("#cc_show_prescribe_dg").datagrid({
											url : 'tocc_queryByElepre',
											queryParams : {
												eleId : cc_ele_id
											}
										});
										$("#cc_show_heSickid").textbox("setText",cc_ele_pname);
										$("#cc_show_hospele_prescribe_win").window("open");
									}
								}
							} else {
								$.messager.alert("提示", "只能选择一条记录，您目前选择了"
										+ rows.length + "条!");
							}
						}
					});
			//查看show_electronic_btn
			//cc_addOne_hospprescribe_win
			var chenchangjg;
			$("#cc_update_hospele_prescribe_add").linkbutton({
				onClick : function() {
					$("#cc_addOne_hospprescribe_win")
					.window({
						title : "添加药品"
					});
					$("#cc_addOne_hospprescribe_win").window("open");
					chenchangjg=0;
				}
				
			});
			var ii;
			$("#cc_update_hosp_prescribe_save").linkbutton({
				onClick : function() {
					var hosppre_Id=$("#cc_hospprescribe_name").combogrid("getValue");
					var hosppre_name=$("#cc_hospprescribe_name").combogrid("getText");
					$("#cc_hospprescribe_id").val(hosppre_Id);
					$.getJSON("tocc_queryBymaiMoney", {"pharStockMedId": hosppre_Id}, function(data){
						$("<form id='cc_hospdddff' type='hidden'>").appendTo($("body"));
						$("<input id='cc_hospmai' name='maiMoney'>").appendTo($("#cc_hospdddff"));
						//$(pharStockMed.target).text("setValue",date);
						$("#cc_hospdddff").form("load",data);//cc_hospprescribe_danjia
						var cc_danjia=$("#cc_hospmai").val();
						var cc_hospprescribe_number=$("#cc_hospprescribe_number").numberbox("getValue");
						if(cc_hospprescribe_number<=0){
							cc_hospprescribe_number=1;
						}
						var uprows=$("#cc_update_prescribe_dg").datagrid("getRows");
						var cc_jg=false;
						for(var i=0;i<uprows.length;i++ && cc_jg==false){
							if(uprows[i].drugId==hosppre_Id){
								var rowepAmount=parseInt(uprows[i].epAmount);
								var cc_epAmoun;
								var cc_edmenoy;
								if(chenchangjg==1){
									cc_epAmoun=cc_hospprescribe_number;
									cc_edmenoy=cc_hospprescribe_number*cc_danjia;
								}else{
									cc_epAmoun=rowepAmount + parseInt(cc_hospprescribe_number);
									cc_edmenoy=uprows[i].edmenoy +cc_hospprescribe_number*cc_danjia;
								}
								
								//highlightRow
								 $('#cc_update_prescribe_dg').datagrid('updateRow',{
									index: i,
									row: {
										drugId: hosppre_Id,
										prescribeName: hosppre_name,
										epAmount: cc_epAmoun,
										edmenoy:cc_edmenoy
									}
								});
								 ii=i;
								cc_jg=true;
							}
						}
						if(cc_jg==false){
							$("#cc_update_prescribe_dg").datagrid('appendRow',{
								drugId: hosppre_Id,
								prescribeName: hosppre_name,
								epAmount: cc_hospprescribe_number,
								edmenoy:cc_hospprescribe_number*cc_danjia
							});
							// $('#cc_update_prescribe_dg').datagrid('highlightRow',uprows.length-1);
							ii=uprows.length;
							//$("#cc_update_prescribe_dg").datagrid('selectRow',ii);
							
						}
						//alert(cc_hospprescribe_number+"++"+cc_danjia);
						$("#cc_update_add_hospelepre_form").form("clear");
						$("#cc_addOne_hospprescribe_win").window("close");
						$("#cc_hospmai").remove();
						$("#cc_hospdddff").remove();
					});
					
				}
			
			});
			
			
			//提交修改
			$("#cc_update_hospele_prescribe_save").linkbutton({
				onClick:function(){
					//getRows
					var rows =$("#cc_update_prescribe_dg").datagrid("getRows");
					var cc_hosppritineid=$("#cc_update_hospele_heSickid").combogrid("getValue");
					updateHospele(rows,ele_id,cc_hosppritineid);
					//updateHospelecheck
				}
			});
			//cc_update_hosp_prescribe_cancel
			$("#cc_update_hosp_prescribe_cancel").linkbutton({
				onClick:function(){
					$("#cc_update_add_hospelepre_form").form("clear");
					$("#cc_addOne_hospprescribe_win").window("close");
				}
			});
			//删除cc_update_hospele_prescribe_del
			$("#cc_update_hospele_prescribe_del").linkbutton({
				onClick:function(){
					$.messager.confirm("提示", "确定要删除吗？", function(v){
						if(v){
							
							var rows =$("#cc_update_prescribe_dg").datagrid("getSelections");
							//deleteRow
							
							for(var i=0;i<rows.length;i++){
								//alert(i);
								var cc_index =$('#cc_update_prescribe_dg').datagrid('getRowIndex', rows[i]);
								$('#cc_update_prescribe_dg').datagrid('deleteRow',cc_index);
							}
						}
					});
				}
			});
			//修改cc_update_hospele_prescribe_up
			$("#cc_update_hospele_prescribe_up").linkbutton({
				onClick:function(){
					var rows =$("#cc_update_prescribe_dg").datagrid("getSelections");
					if(rows.length==1){
						$("#cc_hospprescribe_number").numberbox('setValue',rows[0].epAmount);
						$("#cc_hospprescribe_name").combogrid('setText',rows[0].prescribeName);//prescribeName
						$("#cc_hospprescribe_name").combogrid('setValue',rows[0].drugId);//drugId
						$("#cc_addOne_hospprescribe_win").window({
							 title:'修改药品'
						});
						chenchangjg=1;
						$("#cc_addOne_hospprescribe_win").window('open');
					}else{
						$.messager.alert("提示", "只能选择一条记录，您目前选择了" + rows.length + "条!");
					}
				}
			});
			$("#cc_update_hospele_check_add").linkbutton({
				onClick:function(){
					$("#cc_update_hospele_addOnecheck_win").window("open");
				}
			});
			//cc_update_addOnecheck_save
			$("#cc_update_addOnecheck_save").linkbutton({
				onClick:function(){
					var checkid= $("#cc_addonecheckcombobox").combobox("getValue");
					var checkName= $("#cc_addonecheckcombobox").combobox("getText");
					$("#updatecheckcprId").val(checkid);
					var checkcprNum;
					$.getJSON("tocc_queryOneCheck", {
						"cprId" : checkid
					}, function(data) {
						$("<form id='cc_checkdddfff' type='hidden'>").appendTo($("body"));
						$("<input id='cc_checki' name='cprNum'>").appendTo($("#cc_checkdddfff"))
						$("#cc_checkdddfff").form("load", data);
						$("#updatecheckcprNum").val($("#cc_checki").val());
						checkcprNum= $("#updatecheckcprNum").val();
						var uprows=$("#cc_update_preCheck_dg").datagrid("getRows");
						var checkjg=false; 
						for(var i=0;i<uprows.length;i++){
							if(uprows[i].elecname==checkid){
								checkjg=true;
							}
						}
						if(checkjg==false){
							$("#cc_update_preCheck_dg").datagrid('appendRow',{
								elecname: checkid,
								eleCheckName: checkName,
								etmenoy: checkcprNum,
							});
						}else{
							$.messager.alert("提示", checkName+"项目已经存在！");
						}
						$("#cc_checki").remove();
						$("#cc_checkdddfff").remove();
					});
					$("#cc_update_hospele_addOnecheck_form").form("clear");
					$("#cc_update_hospele_addOnecheck_win").window("close");
				}
			});
			$("#cc_update_addOnecheck_cal").linkbutton({
				onClick:function(){
					$("#cc_update_hospele_addOnecheck_form").form("clear");
					$("#cc_update_hospele_addOnecheck_win").window("close");
				}
			});
			//cc_update_hospele_check_del
			$("#cc_update_hospele_check_del").linkbutton({
				onClick:function(){
					$.messager.confirm("提示", "确定要删除吗？", function(v){
						if(v){
							
							var rows =$("#cc_update_preCheck_dg").datagrid("getSelections");
							//deleteRow
							for(var i=0;i<rows.length;i++){
								//alert(i);
								var cc_index =$('#cc_update_preCheck_dg').datagrid('getRowIndex', rows[i]);
								$('#cc_update_preCheck_dg').datagrid('deleteRow',cc_index);
							}
						}
					});
				}
			});
			//cc_update_hospele_check_save
			$("#cc_update_hospele_check_save").linkbutton({
				onClick:function(){
					//getRows
					var rows =$("#cc_update_preCheck_dg").datagrid("getRows");
					var cc_hosppritineid=$("#cc_update_hospele_check_heSickid").combogrid("getValue");
					updateHospelecheck(rows,ele_id,cc_hosppritineid);
					//updateHospelecheck
				}
			});
			//cc_update_hospele_addOnecheck_form
			//cc_addonecheckcombobox
			//updatecheckcprId
			//updatecheckcprNum
			//cc_update_addOnecheck_cal
		});
	</script>
	
	<div style="display: none">
		<input id="pdoctoerid">
	</div>
	<table id="show_query_hospele_tab" class="easyui-datagrid"
		data-options="
								fitColumns:true,
								fit:true,
								rownumbers: true,
								striped:true,
								toolbar: '#cc_electronic_btn',
								pagination:true,
								pageSize: 16,
								pageList:[16,32,64,128],
								border:false,
								rowStyler: cc_hosp_rowStlye
							">
		<thead>
			<tr>
				<th data-options="field:'heId',width:'10%',checkbox:true">处方编号</th>
				<th data-options="field:'pname',width:'15%'">病人姓名</th>
				<th data-options="field:'icid',width:'20%'">医疗卡号</th>
				<th data-options="field:'heType', width:'10%'">处方类型</th>
				<th data-options="field:'staffname', width:'20%'">开处方人</th>
				<th data-options="field:'heDate',width:'20%'">开具时间</th>
				<th data-options="field:'hospeleRemarks', width:'12%'">处方状态</th>

			</tr>
		</thead>
	</table>
	<div id="cc_electronic_btn" width="100%">
		<a id="add_electronic_prescribe_btn" class="easyui-linkbutton"
			data-options="iconCls:'icon-kaiyao',plain:true">添加药品处方</a> <a
			id="add_electronic_check_btn" class="easyui-linkbutton"
			data-options="iconCls:'icon-add',plain:true">添加检查处方</a> <a
			id="up_electronic_btn" class="easyui-linkbutton"
			data-options="iconCls:'icon-edit',plain:true">修改处方</a> <a
			id="cc_hospelectronic_ref" class="easyui-linkbutton"
			data-options="iconCls:'icon-reload',plain:true">刷新</a><input
			id="cc_electronicsearch" class="easyui-searchbox"
			data-options="menu:'#cc_electronicee',width:220,prompt:'请输入你要查找的内容'">
	</div>
	<div id="cc_electronicee" style=" width:90px">
		<div date-options="name:'name'">医疗卡编号</div>
		<div date-options="name:'name'">病人姓名</div>
	</div>
	<div id="cc_eait_hospele_prescribe_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 530,
		     height: 400,
		     closed: true,
		     modal:true,
		     title:'处方信息操作'
			">

		<form id="cc_eait_hospele_prescribe_form"
			action="tocc_addhospEleprescribe" method="post">
			<div style="display: none">
				<input id="cc_hospele_heDoctorid" name="chospele.heDoctorid"
					>
			</div>
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				<select id="cc_hospele_heSickid" name="chospele.heSickid"
					class="easyui-combogrid"
					data-options="
							labelAlign:'right', width: 200,
							label:'患者:',
							panelHeight: 'auto',
							required: true,
     						missingMessage: '患者不能为空',
							panelWidth: '223',
							idField: 'patientid',
							textField: 'pname',
							columns: [[
								{field: 'patientid', title: '患者编号', width: 80},
								{field: 'icid', title: '患者IC卡号', width: 80},
								{field: 'pname', title: '患者姓名', width: 60},
							]]
						"></select>
				<select id="cc_hospele_heType" class="easyui-combobox"
					name="chospele.heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90">
					<option value="开药">开药</option>
				</select>
			</div>
			<div style="margin: 5px; height: 270px">
				<div id="cc_prescribe_name_tt" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_prescribe_dg" class="easyui-datagrid"
							style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								singleSelect: true,
								toolbar: '#cc_hospele_tb',
								method: 'get',
								onClickCell: onClickCell,
								onEndEdit: onEndEdit,
								width: '100%'
							">
							<thead>
								<tr>
									<th
										data-options="field:'list.drugId',width:'25%',editor:{type:'textbox',options:{required: 'true'}},hidden:true">药品编号</th>
									<th
										data-options="field:'list.prescribeName',width:'25%',editor:{
									type:'combogrid',
									options:{
									panelWidth:303,
									panelHeight:'auto',
									toolbar:'#cc_querypharStockMedtt_search',
	 							    idField:'pharStockMedId',
								    textField:'pharStockMedName',
								    required: true,
								    url:'tocc_queryAllYp',
								    pagination:true,
								    pageSize: 6,
									pageList:[6,12,24,48],
								    columns:[[
									    {field:'pharStockMedId',title:'编号',width:95},
									    {field:'pharStockMedName',title:'药名',width:100},
									    {field:'pharStockGuige',title:'规格',width:60},
									    {field:'maiMoney',title:'售价',width:45},
								    ]]}
								}">药品名称</th>
									<th
										data-options="field:'list.epAmount',width:'25%',editor:{type:'numberbox',options:{precision:0,required: 'true',}}">数量</th>
									<th
										data-options="field:'mai_Money',width:'25%',align:'center',editor:{type:'textbox',options:{readonly:'true',}}">单价</th>
									<th
										data-options="field:'list.edmenoy',width:'24%',align:'center',editor:{type:'textbox',options:{readonly:'true'}}">总金额</th>
								</tr>
							</thead>
						</table>

						<div id="cc_hospele_tb" style="height: auto">
							<a href="javascript:void(0)" class="easyui-linkbutton"
								data-options="iconCls:'icon-add',plain:true" onclick="append()">添加一行</a>
							<a href="javascript:void(0)" class="easyui-linkbutton"
								data-options="iconCls:'icon-remove',plain:true"
								onclick="removeit()">移除一行</a> <a href="javascript:void(0)"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-ok',plain:true" onclick="accept()">应用</a>
							<a href="javascript:void(0)" class="easyui-linkbutton"
								data-options="iconCls:'icon-undo',plain:true" onclick="reject()">撤销</a>
							<a id="cc_hospele_prescribe_save" class="easyui-linkbutton"
								data-options="iconCls:'icon-baocun',plain:true"
								onclick="saveHospele()" style="margin-left: 100px">提交处方</a>
						</div>
						<div style="display: none;">
						<div id="cc_querypharStockMedtt_search" style="height: auto;">
							<input id="cc_pharStock_search" class="easyui-searchbox"
								data-options="menu:'#cc_pharStock22_ee',width:200,prompt:'请输入你要查找的内容'">
						</div>
						<div id="cc_pharStock22_ee" style="width: 50px">
							<div date-options="name:'name'">药名</div>
						</div>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div id="cc_eait_hospele_check_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 530,
		     height: 400,
		     closed: true,
		      modal:true,
		     title:'处方信息操作'
			">

		<form id="cc_eait_hospele_check_form" action="tocc_addhospEleCheck"
			method="post">
			<div style="display: none">
				<input id="cc_hospele_check_heDoctorid" name="chospele.heDoctorid"
					>
			</div>
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				<select id="cc_hospele_check_heSickid" name="chospele.heSickid"
					class="easyui-combogrid"
					data-options="
							labelAlign:'right', width: 200,
							label:'患者:',
							panelHeight: 'auto',
							required: true,
     						missingMessage: '患者不能为空',
							panelWidth: '223',
							idField: 'patientid',
							textField: 'pname',
							columns: [[
								{field: 'patientid', title: '患者编号', width: 80},
								{field: 'icid', title: '患者IC卡号', width: 80},
								{field: 'pname', title: '患者姓名', width: 60},
							]]
						"></select>
				<select id="cc_hospele_check_heType" class="easyui-combobox"
					name="chospele.heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90">
					<option value="检查">检查</option>
				</select>
			</div>
			<div style="margin: 5px;">
				<div id="cc_check_name_tt" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_prescribe_check_dg" class="easyui-datagrid"
							style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								singleSelect: true,
								toolbar: '#cc_hospele_check_tb',
								method: 'get',
								onClickCell: cc_onClickCell,
								onEndEdit: cc_onEndEdit,
								width: '100%'
							">
							<thead>
								<tr>
									<th
										data-options="field:'list.elecname',width:'25%',editor:{type:'textbox',options:{required: 'true'}},hidden:true">药品编号</th>
									<th
										data-options="field:'list.eleCheckName',width:'33%',editor:{
									type:'combogrid',
									options:{
									panelWidth:213,
								    idField:'cprId',
								    textField:'cprProject',
								    required: true,
								    url:'tocc_queryAllCheck',
								    columns:[[
									    {field:'cprId',title:'编号',width:75},
									    {field:'cprProject',title:'项目名称',width:90},
									    {field:'cprNum',title:'检查费',width:45},
								    ]]}
								}">检查项目</th>
									<th
										data-options="field:'check_etAmount',width:'25%',editor:{type:'numberbox',options:{precision:0,readonly:'true'}},hidden:true">数量</th>
									<th
										data-options="field:'cprNum',width:'33%',align:'center',editor:{type:'textbox',options:{readonly:'true',}}">单价</th>
									<th
										data-options="field:'list.etmenoy',width:'33%',align:'center',editor:{type:'textbox',options:{readonly:'true'}}">总金额</th>
								</tr>
							</thead>
						</table>

						<div id="cc_hospele_check_tb" style="height: auto">
							<a href="javascript:void(0)" class="easyui-linkbutton"
								data-options="iconCls:'icon-add',plain:true"
								onclick="cc_append()">添加一行</a> <a href="javascript:void(0)"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-remove',plain:true"
								onclick="cc_removeit()">移除一行</a> <a href="javascript:void(0)"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-ok',plain:true"
								onclick="cc_accept()">应用</a> <a href="javascript:void(0)"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-undo',plain:true"
								onclick="cc_reject()">撤销</a> <a id="cc_hospele_check_save"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-baocun',plain:true"
								onclick="cc_saveHospele()" style="margin-left: 100px">提交处方</a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
<div id="cc_update_hospele_prescribe_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 530,
		     height:400,
		      modal:true,
		     closed: true,
		     title:'处方信息操作'
			">

		<form id="cc_update_hospele_heSickid_form" action="" method="post">
			<div style="display: none">
				<input id="cc_hospele_heDoctorid" name="chospele.heDoctorid"
					>
			</div>
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				<select id="cc_update_hospele_heSickid" name="heSickid"
					class="easyui-combogrid"
					data-options="
							labelAlign:'right', width: 200,
							label:'患者:',
							panelHeight: 'auto',
							required: true,
     						missingMessage: '患者不能为空',
							panelWidth: '223',
							idField: 'patientid',
							textField: 'pname',
							columns: [[
								{field: 'patientid', title: '患者编号', width: 80},
								{field: 'icid', title: '患者IC卡号', width: 60},
								{field: 'pname', title: '患者姓名', width: 80},
							]]
						"></select>
				<select id="cc_update_hospele_heType" class="easyui-combobox"
					name="heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90">
					<option value="开药">开药</option>
				</select>
			</div>
			<div style="margin: 5px;">
				<div id="cc_prescribe_name_tt" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_update_prescribe_dg" class="easyui-datagrid"
							style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								method: 'get',
								toolbar: '#cc_update_hospele_tb',
								width: '100%'
							">
							<thead>
								<tr>
									<th data-options="field:'drugId',checkbox:true">药品编号</th>
									<th
										data-options="field:'prescribeName',width:'40%',align:'center'">药品名称</th>
									<th data-options="field:'epAmount',width:'25%',align:'center'">数量</th>
									<th data-options="field:'edmenoy',width:'33%',align:'center'">总金额</th>
								</tr>
							</thead>
						</table>

						<div id="cc_update_hospele_tb" style="height: auto">
							<a id="cc_update_hospele_prescribe_add" class="easyui-linkbutton"
								data-options="iconCls:'icon-add',plain:true" onclick="">添加药品</a>
							<a id="cc_update_hospele_prescribe_up" class="easyui-linkbutton"
								data-options="iconCls:'icon-ok',plain:true" onclick="">修改药品</a>
							<a id="cc_update_hospele_prescribe_del" class="easyui-linkbutton"
								data-options="iconCls:'icon-remove',plain:true" onclick="">删除药品</a>
							<a id="cc_update_hospele_prescribe_save"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-baocun',plain:true" onclick=""
								style="margin-left: 100px">保存处方</a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div id="cc_addOne_hospprescribe_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 300,
		     height: 170,
		      modal:true,
		     closed: true,
		     title:'添加药品'
			">
		<form id="cc_update_add_hospelepre_form" action="" method="post">
			<div style="display: none">
				<input id="cc_hospprescribe_id"> <input
					id="cc_hospprescribe_danjia">
			</div>

			<div class="cc_item">
				<select id="cc_hospprescribe_name" class="easyui-combogrid"
					data-options="
							labelAlign:'right', width: 260,
							label:'药品名称:',
							panelHeight: 'auto',
							panelWidth: '313',
							url:'tocc_queryAllYp',
							pagination:true,
							pageSize: 6,
							pageList:[6,12,24,48],
							idField: 'pharStockMedId',
							textField: 'pharStockMedName',
							columns: [[
								{field: 'pharStockMedId', title: '药品编号', width: 130},
								{field: 'pharStockMedName', title: '药品名称', width: 130},
								{field:'maiMoney',title:'售价',width:40},
							]]
						"></select>
			</div>
			<div class="cc_item">
				<input id="cc_hospprescribe_number" class="easyui-numberbox"
					data-options="label: '药品数量:',precision:0, labelAlign:'right',width: 260">
			</div>

			<div style="margin-left: 20%; padding-top: 5px">
				<a id="cc_update_hosp_prescribe_save" class="easyui-linkbutton"
					data-options="iconCls:'icon-baocun'">确定</a> <a id="cc_update_hosp_prescribe_cancel"
					style="margin-left: 40px" class="easyui-linkbutton"
					data-options="iconCls:'icon-chexiao'">取消</a>
			</div>
		</form>
	</div>
	<div id="cc_show_hospele_prescribe_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-help',
		     width: 530,
		     height: 'auto',
		      modal:true,
		     closed: true,
		     title:'处方详细信息'
			">

		<form id="cc_show_hospele_heSickid_form" action="" method="post">
			<div style="display: none">
				<input id="" name="chospele.heDoctorid" >
			</div>
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				
				<input id="cc_show_heSickid" class="easyui-textbox" data-options="labelAlign:'right', width: 200,label:'患者:',">
				<select id="" class="easyui-combobox"
					name="heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90,readonly:true">
					<option value="开药">开药</option>
				</select>
			</div>
			<div style="margin: 5px; ">
				<div id="" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_show_prescribe_dg" class="easyui-datagrid" style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								singleSelect: true,
								method: 'get',
								width: '100%'
							">
							<thead>
								<tr>
									<th data-options="field:'drugId',width:'16%'">药品编号</th>
									<th
										data-options="field:'prescribeName',width:'35%',align:'center'">药品名称</th>
									<th data-options="field:'epAmount',width:'22%',align:'center'">数量</th>
									<th data-options="field:'edmenoy',width:'27%',align:'center'">总金额</th>
								</tr>
							</thead>
						</table>

					</div>
				</div>
			</div>
		</form>
	</div>
<div id="cc_update_hospele_check_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-banliyewu',
		     width: 530,
		     height:400,
		      modal:true,
		     closed: true,
		     title:'处方信息操作'
			">

		<form id="cc_update_hospele_check_heSickid_form" action="" method="post">
			<div style="display: none">
				<input id="cc_hospele_heDoctorid" name="chospele.heDoctorid"
			>
			</div>
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				<select id="cc_update_hospele_check_heSickid" name="heSickid"
					class="easyui-combogrid"
					data-options="
							labelAlign:'right', width: 200,
							label:'患者:',
							panelHeight: 'auto',
							required: true,
     						missingMessage: '患者不能为空',
							panelWidth: '223',
							idField: 'patientid',
							textField: 'pname',
							columns: [[
								{field: 'patientid', title: '患者编号', width: 80},
								{field: 'icid', title: '患者IC卡号', width: 60},
								{field: 'pname', title: '患者姓名', width: 80},
							]]
						"></select>
				<select id="cc_update_check_heType" class="easyui-combobox"
					name="heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90">
					<option value="检查">检查</option>
				</select>
			</div>
			<div style="margin: 5px;">
				<div id="cc_check_name_tt" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_update_preCheck_dg" class="easyui-datagrid"
							style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								method: 'get',
								toolbar: '#cc_update_hospelecheck_tb',
								width: '100%'
							">
							<thead>
								<tr>
									<th data-options="field:'elecname',checkbox:true">项目编号</th>
									<th data-options="field:'eleCheckName',width:'51%',align:'center'">项目名称</th>
									<th data-options="field:'etmenoy',width:'43%',align:'center'">总金额</th>
								</tr>
							</thead>
						</table>

						<div id="cc_update_hospelecheck_tb" style="height: auto">
							<a id="cc_update_hospele_check_add" class="easyui-linkbutton"
								data-options="iconCls:'icon-add',plain:true" onclick="">添加检查项目</a>
					
							<a id="cc_update_hospele_check_del" class="easyui-linkbutton"
								data-options="iconCls:'icon-remove',plain:true" onclick="">删除检查项目</a>
							<a id="cc_update_hospele_check_save"
								class="easyui-linkbutton"
								data-options="iconCls:'icon-baocun',plain:true" onclick=""
								style="margin-left: 130px">保存处方</a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div id="cc_update_hospele_addOnecheck_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="iconCls:'icon-banliyewu',
		     width: 300,
		     height: 120,
		      modal:true,
		     closed: true,
		     title:'添加检查项目'
			">
			<form id="cc_update_hospele_addOnecheck_form" action="" method="post">
			<div style="display: none">
					<input id="updatecheckcprId"> 
					<input id="updatecheckcprNum">
				</div>
			<div class="cc_item">
				<select id="cc_addonecheckcombobox" class="easyui-combobox" data-options="
					labelAlign:'right',
					label:'检查项目:',
					width:260,
					panelHeight: 'auto',
					panelWidth: '200',
					url: 'tocc_queryAllCheck',
					valueField:'cprId',
                    textField:'cprProject'"
					></select>
			</div>
			<div style="margin-left: 20%; padding-top: 5px">
				<a id="cc_update_addOnecheck_save" class="easyui-linkbutton" data-options="iconCls:'icon-baocun'">确定</a> 
				<a id="cc_update_addOnecheck_cal" style="margin-left: 40px" class="easyui-linkbutton" data-options="iconCls:'icon-chexiao'">取消</a>
			</div>
			</form>
	</div>
	<div id="cc_show_hospele_check_win" class="easyui-window"
		style="padding: 0px; line-height: 150%;"
		data-options="
			iconCls:'icon-help',
		    width: 530,
		    height: 'auto',
			closed: true,
			 modal:true,
		    title:'处方详细信息'
			">

		<form id="cc_show_hospele_check_heSickid_form" action="" method="post">
			
			<div class="cc_item"
				style="background: rgb(236, 243, 255); padding: 10px; border-radius: 5px; margin: 0px">
				
				<input id="cc_show_check_heSickid" class="easyui-textbox" data-options="labelAlign:'right', width: 200,label:'患者:',readonly:true">
				<select id="" class="easyui-combobox"
					name="heType" style="width: 200px;"
					data-options="labelAlign:'right',label:'处方类型:',panelHeight: 'auto',width: 90,readonly:true">
					<option value="检查">检查</option>
				</select>
			</div>
			<div style="margin: 5px; ">
				<div id="" class="easyui-tabs"
					style="width: 100%; margin-top: 10px;"
					data-options="plain:true,narrow:true">
					<div title="处方详细信息" style="padding: 10px;">
						<table id="cc_show_hospeletronic_check_dg" class="easyui-datagrid" style="height: auto"
							data-options="
								iconCls: 'icon-edit',
								singleSelect: true,
								method: 'get',
								width: '100%'
							">
							<thead>
								<tr>
									<th data-options="field:'elecname',width:'12%',align:'center'">编号</th>
									<th data-options="field:'eleCheckName',width:'21%',align:'center'">项目名称</th>
									<th data-options="field:'etmenoy',width:'14%',align:'center'">总金额</th>
									<th data-options="field:'checkrameks',width:'27%',align:'center'">检查状态</th>
									<th data-options="field:'photofruit',width:'27%',align:'center',hidden:'true'">检查结果</th>
									<th data-options="field:'xx',width:'27%',align:'center',
										formatter:img
									">结果</th>
									<script>
										var img = function(value,row,index){
											var a = '<a href=javascript:ccd("' + row.photofruit +'","'+row.checkrameks + '")>查看详情</a>'
						        			return  a ;
						        		};
									</script>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
		</form>
	</div>
	<div id="cc_patientcheck_img_win" class="easyui-window" 
		title="查看检查结果" style="width:70%;height:500px;text-align:center;line-height:500px;background: rgb(236,243,255);"   
	        data-options="iconCls:'icon-save',closed: true, modal:true">   
		    <div style="margin:auto;margin-top:8%;line-height:500px;">
				<img  id="cc_show_img" >
			</div>
	</div>
	<script type="text/javascript">
		function ccd(photofruit,checkrameks){
			if(checkrameks=="已完成"&& photofruit!=null){
				//<c:url value="/js/easyui-lang-zh_CN.js"/>
				$("#cc_show_img").attr({
					src:photofruit
				});
				$("#cc_patientcheck_img_win").window('open');
			}
		}
	</script>
</body>
</html>